/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.fatecpg.songs.site.managedbeans;

import java.io.Serializable;
import br.com.fatecpg.songs.dao.util.DAOException;
import br.com.fatecpg.songs.util.FacesContextUtil;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

/**
 * Classe usada para fazer o redirecionamento das pesquisas após preencher
 * palavra-chave e buscar.
 * @author Marcos
 */

@ManagedBean
@ViewScoped
public class SearchManagedBean implements Serializable{
    private static final String SEARCH_ARTIST = "artist";
    private static final String SEARCH_ALBUM = "album";
    private static final String SEARCH_MUSIC = "song";    
    private String searchedWord;
    private String searchType;  

    public SearchManagedBean(){
        searchType = SEARCH_ARTIST;
    }
    
    public String getSearchType() {
        return searchType;
    }

    public void setSearchType(String searchType) {
        this.searchType = searchType;
    }

    public String getSEARCH_ARTIST() {
        return SEARCH_ARTIST;
    }

    public String getSEARCH_ALBUM() {
        return SEARCH_ALBUM;
    }

    public String getSEARCH_MUSIC() {
        return SEARCH_MUSIC;
    }

    public String getSearchedWord() {
        return searchedWord;
    }

    public void setSearchedWord(String searchedWord) {
        this.searchedWord = searchedWord;
    }        
    // redireciona para o resulto de acordo com o tipo de pesquisa selecionada
    public void search() throws DAOException{
        FacesContextUtil.handleNavigation(searchType);
    }         
}
